import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { PropItem } from "../player/acupoint/PropItem";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { Cache } from "../../cache/Cache";
import { ClockManager } from "../../manager/ClockManager";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { SHaveInvestInfo } from "../../../../Message/Public/SHaveInvestInfo";
//class InvestmentPlanRewardCellRender
    
    export  class InvestmentPlanRewardCellRender extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            super.configUI();
            this._bg = new Object /* flash.display.Bitmap */();
            this.addChild(this._bg);
            this._dayTxtBmp = new Object /* flash.display.Bitmap */();
            this.addChild(this._dayTxtBmp);
            this._dayTxtBmp.x = 14;
            this._dayTxtBmp.y = 3;
            this._dayTxt = ObjCreate.createGTextField("", 28, 4, 20, 25, this, new Object /* flash.text.TextFormat */(null, 12, 16777215));
            this._nameTxt = ObjCreate.createGTextField("", 3, 103, 115, 25, this, new Object /* flash.text.TextFormat */(null, 12, GlobalStyle.color6Uint, null, null, null, null, null, "center"));
            this._propItem = new PropItem();
            this._propItem.setSize(34, 34);
            this._propItem.isBig = true;
            this.addChild(this._propItem);
            this._propItem.move(29, 38);
            this._propItem.isDragAble = false;
            LoaderHelp.addResCallBack(ResFileConst.investPlan, this.onLoaded);
            return;
        }

        /* internal  */onLoaded(): void
        {
            this._bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.investItemBg);
            this._dayTxtBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.investRewardDaytxt);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc3=null;
            if (arg1 == null) 
            {
                return;
            }
            super.data = arg1;
            var loc1=arg1.itemData;
            this._propItem.itemData = arg1.itemData;
            this._propItem.drawNow();
            this._propItem.amount = -1;
            this._dayTxt.text = arg1.day;
            this._nameTxt.text = loc1.name + "x" + arg1.num;
            var loc2=Cache.instance.investment.getInvestedInfoById(arg1.id);
            if (loc2) 
            {
                loc3 = new Date(loc2.startDt.fullYear, loc2.startDt.month, loc2.startDt.date);
                loc3.date = (loc3.date - 1) + arg1.day;
                if (ClockManager.instance.nowDate >= loc3) 
                {
                    this.filters = [FilterConst.colorFilter2];
                }
                else 
                {
                    this.filters = [];
                }
            }
            else 
            {
                this.filters = [];
            }
            return;
        }

        /* internal */ /* var */_dayTxt: GTextFiled;

        /* internal */ /* var */_nameTxt: GTextFiled;

        /* internal */ /* var */_dayTxtBmp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_investedInfo: SHaveInvestInfo;

        /* internal */ /* var */_propItem: PropItem;

        /* internal */ /* var */_bg: Object /* flash.display.Bitmap */;
    }
